Entry

Overview

An entry represent a payload of content appended to a thread's at a specific time by a specific user or role

  • From version: 2020.20

Properties

attachments

attachments: Attachment[]

This property returns the listing of attachments for this specific entry in the tread. Each attachment is an independent file including audio files, office documents etc.

const currentEntry = workflowApi.currentThread.entries[0];
const entryAttachments = currentEntry.attachments;

content

content: object

This object holds the payload of content that is stored in each entry of the thread. The payload can be of any JSON structure to suit the needs of the specific application chosen.

const currentEntry = workflowApi.currentThread.entries[0];
currentEntry.content = {"Message": "Good work!", Tasks: ["Make a presentation","Check grid"]};

createDate

createDate: Date

The date when the entry was created.

workflowApi.currentThread.entries[0].createDate;

id

id: string

The entry object's unique id.

workflowApi.currentThread.entries[0].id;

owner

owner: Contact

The owner or user that created the entry.

const currentEntry = workflowApi.currentThread.entries[0];
if(workflowApi.session.currentUser.id === currentEntry.owner.id){
 console.log("You can enable options for owner user only")
}

Methods

addNewAttachment

addNewAttachment ( attachmentType : AttachmentType ): Attachment

This function adds a new attachment to the entry.

createNewAttachmentButton.addEventListener('click', () => {
		const currentEntry = workflowApi.currentThread.entries[0];
		const newAttachment = currentEntry.addNewAttachment();
		newAttachment.caption = "New Attachment";
		newAttachment.setAttachmentContent("{}");
 	currentEntry.save();
});

Parameters

  • attachmentType:AttachmentType

    The type of the new attachment you want to create.

Returns Attachment

Attachment-The new Attachment for you to add to the entry.

removeAttachment

removeAttachment ( attachmentId : string): void

This function removes the selected attachment object from the entry's attachments list.

removeFirstAttachmentButton.onclick = function(event) {
		const currentEntry =  workflowApi.currentThread.getLastEntries(1)[0];
		const attachment = currentEntry.attachments[0];
		currentEntry.removeAttachment(attachment.id);
}

Parameters

  • attachmentId:string

    the attachment that you want to delete's id.

Returns void

save

save (): Promise<void>

This function saves any changes made to the entry object.

const currentEntry = workflowApi.currentThread.entries[0];
workflowApi.canvas.showSpinner();
currentEntry.save().then(() => {
    console.log("The Entry has been saved");
  }).finally(() =>  {
    workflowApi.canvas.hideSpinner();
  });
Returns Promise<void>